from flask import Flask
from base import db, ma
from blog.appone.views import blueprint as blog_blueprint
# from blog.apptwo.balala


def create_app(config=None):


    app = Flask(__name__)

    # app.config.from_object(config)
    app.config['DEBUG'] = True
    app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://:@localhost/learn1'
    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True

    if config:
        app.config.update(config)

    db.init_app(app)
    ma.init_app(app)
    app.register_blueprint(blog_blueprint)

    return app
